#include "../include/BuySellIndicator.h"
#include <iostream>
using namespace std;
BuySellIndicator::BuySellIndicator()
{
}

BuySellIndicator::BuySellIndicator(int riseUntilBuy, int fallUntilSell): _countUp(0), _countDown(0), _riseUntilBuy(riseUntilBuy), _fallUntilSell(fallUntilSell), _buy(false), _sell(false){

}


void BuySellIndicator::countUp(){
	if (_countUp < _riseUntilBuy-1){
		_countUp++;
		_countDown =0;
	}
	else{
		_countUp = 0;
		buy();
	}
}
void BuySellIndicator::countDown(){
	if (_countDown < _fallUntilSell-1){
		_countDown++;
		_countUp =0;
	}
	else{
		_countDown = 0;
		sell();
	}
}
void BuySellIndicator::buy(){
	_buy = true;
	_sell = false;
}
void BuySellIndicator::sell(){
	_sell = true;
	_buy = false;
}

bool BuySellIndicator::getBuy(){
	bool ans = _buy;
	if (_buy) {
		_buy = false;
	}
	return ans;
}
bool BuySellIndicator::getSell(){
	bool ans = _sell;
	if (_sell) {
		_sell = false;
	}
	return ans;
}




BuySellIndicator::~BuySellIndicator()
{
}
